import express, { Express, Router, Request, Response } from 'express'
import axios from 'axios'
const app: Express = express()
app.use('*', ( req, res, next ) => {
    res.header('Access-Control-Allow-Origin', '*')
    next()
})

const router: Router = express.Router()

app.use('/api', router)

router.get('/list', async (req: Request, res: Response) => {
    // 疫情接口已经关闭https://api.inews.qq.com/newsqa/v1/query/inner/publish/modules/list?modules=statisGradeCityDetail,diseaseh5Shelf，
    // apifox自己mock：http://127.0.0.1:4523/m1/5860816-5547215-default/list
    const result = await axios.get('http://127.0.0.1:4523/m1/5860816-5547215-default/list')
    res.json({
        ...result.data
    })
})

app.listen(3333, () => {
    console.log('success server http://localhost:3333')
})